package cookie;


import java.io.IOException;
import java.net.URLEncoder;

import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ShowCookie extends HttpServlet {
	@Override
	protected void service(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		Cookie cookie = new Cookie("username", "qych");
		//中文
		Cookie chzhh = new Cookie("chzhh",URLEncoder.encode("陈祖红", "utf-8"));
		response.addCookie(chzhh);
		response.addCookie(cookie);
	}
}
